<?php
error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE);
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap();

//App config
$app_config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/config.ini', $argv[1]);
Zend_Registry::set('HT_Config', $app_config);

//Set timezone
date_default_timezone_set($app_config->timezone);
Zend_Date::setOptions(array('format_type' => 'php'));

//Db adapter
$db = Zend_Db::factory('Pdo_Mysql', $app_config->db->toArray());
$db->setFetchMode(Zend_Db::FETCH_OBJ);
Zend_Db_Table_Abstract::setDefaultAdapter($db);

//Set locale
Zend_Registry::set('Zend_Locale', $app_config->locale->default);
HTech_Locale::setLocaleObj($app_config->locale->default);
HTech_Locale::setTranslateObj();

//$users = new Zend_Db_Table(array('name' => 'users', 'primary' => 'Email'));
//$user = $users->find('abzic@yahoo.com');
//print_r($user->current()->toArray());exit;
